package com.woniuxy.woniubookmanager.mapper;

import com.woniuxy.woniubookmanager.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.woniubookmanager.vo.RoleAuthority;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wugd
 * @since 2022-11-29 04:03:13
 */
@Mapper
public interface RoleMapper extends BaseMapper<Role> {
    
    @Delete("delete from t_manager_role where role_id = #{id}")
    void deleteManageAndRoleOfRelationByRoleId(Long id);


    @Delete("delete from t_role_url_permission where role_id = #{id}")
    void deletePerByRoleid(Long id);

    void insertAuthority(RoleAuthority roleAuthority);


    @Select("select mr.role_id from t_manager m inner join t_manager_role mr on m.id = mr.manager_id where m.id = #{id}")
    Long[] selectRoleIdByMid(Long id);
}
